<?php

namespace App\Module\Api\Controllers;
use App\Module\Api\Controllers\Request\OrderSubmitRequest;
use App\Module\Api\Validator\OrderSubmitValidator;
use App\System\Base\Services\TokenService;
use App\System\Order\Repositories\OrderInfoRepository;

/**
 *订单提交
 */
class OrderSubmitController extends Controller
{

    public function __construct()
    {
        $this->query = new OrderSubmitRequest();
        parent::__construct();

    }

    public function index()
    {
        (new OrderSubmitValidator())->check();
         TokenService::getUserId();
         TokenService::getMasterId();
         $order = OrderInfoRepository::getInstance();
         $id = $order->generateOrder($this->query);
        return apiResponse(['id'=>$id]);
    }
}
